
<template>
	<!-- 添加弹框 -->
	<el-dialog title="web学生考试成绩添加管理" :visible.sync="dialogTableVisible" class="wrap" @close="cancel" :close-on-click-modal="false">
		<div class="input-block">
			<span>id：</span>
			<el-input v-model="vids" placeholder="请输入id" icon="add" class="input"></el-input>
		</div>
		<el-button type="info" class="submit" @click="submit">保存</el-button>
	</el-dialog>
</template>
<script type="text/javascript">
	import qs from 'qs'
	export default {
		data() {
			return {
				vids: '',
				dialogTableVisible: true
			}
		},
		methods: {
			submit() {
				//检测
				this.$store.state.loading = true;
			   /* if(!this.mc) {
					this.$message.warning('请填写分类名称');
					this.$store.state.loading = false;
					return;
				} */
				var logininfo = JSON.parse(localStorage.logininfo);
				var params3 = qs.stringify({
			ids: this.vids,
					yhid: logininfo.id,
					xxid:logininfo.xxid
				});
				//执行
				this.axios.post(this.$store.state.api + 'ksscore/insert', params3)
					.then(res => {
						if(res.data.code == 1) {
							this.$emit('close', { type: 'add', cancel: false });
							this.$store.state.loading = false;
						} else {
							this.$emit('close', { type: 'add', cancel: false });
							this.$store.state.loading = false;
						}
					}).catch(res => {
						this.$message.warning("服务器繁忙，请重试");
						//this.$emit('close', { type: 'add', cancel: false });
						this.$store.state.loading = false;
					})
			},
			cancel() {
				this.$emit('close', { type: 'add', cancel: true })
			}
		}
	}
</script>
<style lang="less" scoped>
	.wrap {
		.input-block {
			margin-bottom: 20px;
			text-align: center;
		}
		.input {
			width: 300px;
			display: inline-block;
		}
		.input-block span {
			display: inline-block;
			width: 70px;
			text-align: right;
		}
		.submit {
			width: 120px;
			display: block;
			margin: 0 auto;
			margin-top: 20px;
		}
	}
</style>
